
// 升序
function binarySearch(arr, target){
    let l = 0,r = arr.length;
    while (l < r){
        let mid  = (l + r) >>1
        if (arr[mid] > target){
            r = mid -1
        }else  if (arr[mid] < target){
            l = mid +1
        }else {
            return mid
        }
    }
    return -1 ;
}